{* Extend our master template *}
{extends file="master.tpl"}

{* This block is defined in the master.php template *}
{block name=content}
    <div class="row">
        <div class="col-md-12">
            <form id="form" class="form-horizontal" method="post">
                <input type="hidden" name="id" value="{$user->id}" />
                {$csrf|form_hidden}
                <div class="panel panel-default">
                    {include file="components/panel_heading.tpl" title=$title sub_title=$sub_title}
                    <!-- <div class="panel-heading">
                        <div class="panel-btns">
                            <a href="#" class="panel-close">&times;</a>
                            <a href="#" class="minimize">&minus;</a>
                        </div>
                        <h4 class="panel-title">{'edit_user_heading'|lang}</h4>
                        <p>{'edit_user_subheading'|lang}</p>
                    </div> -->
                    <div class="panel-body">
                        
                        <div id="infoMessage">{$message}</div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">{'edit_user_fname_label'|lang} <span class="asterisk">*</span></label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="first_name" value="{$first_name['value']}" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">{'edit_user_lname_label'|lang} <span class="asterisk">*</span></label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="last_name" value="{$last_name['value']}" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">{'edit_user_password_label'|lang} <span class="asterisk">*</span></label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="password" value="{$password['value']}" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">{'edit_user_password_confirm_label'|lang} <span class="asterisk">*</span></label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="password_confirm" value="{$password_confirm['value']}" required>
                            </div>
                        </div>

                        <!-- USER GROUPS --> 
                        <div class="form-group">
                            <label class="col-sm-3 control-label">{'edit_user_groups_heading'|lang} <span class="asterisk">*</span></label>
                            <div class="col-sm-3">
                                {foreach from=$groups item=group}
                                    <label class="checkbox">
                                        {assign var="gID" value=$group['id']}
                                        {assign var="checked" value=NULL}
                                        {assign var="$item" value=NULL}
                                        {foreach from=$currentGroups item=grp}
                                            {if $gID == $grp->id}
                                                {assign var="checked" value=' checked="checked"'}
                                                {break}
                                            {/if}
                                        {/foreach}
                                        <input type="checkbox" name="groups[]" value="{$group['id']}"{$checked} />
                                        {$group['name']}
                                    </label>
                                {/foreach}
                            </div>
                        </div>

                    </div><!-- panel-body -->
                    {include file="components/panel_footer.tpl"}
                </div><!-- panel -->
            </form>
        </div>
    </div>
{/block}